﻿// -- JS Handlers for GetControlHTML --

function AsyncWebPartGetData(rowLimit, usePaging, cacheResultMinutes, requestedStartRow, cacheKey, containerID) 
{
    //Remember to use entire namespace + class before method name
    AsyncWebPart.AsyncWebPartService.GetUIHtml(rowLimit, usePaging, cacheResultMinutes, requestedStartRow, cacheKey, AsyncWebPartComplete, AsyncWebPartError, containerID);
}

//Client-side onComplete handler
function AsyncWebPartComplete(response, containerID) 
{
    //Populates the container with the response
    var containerDiv = document.getElementById(containerID);
    containerDiv.innerHTML = response;
}

//Client-side onError handler
function AsyncWebPartError(response, containerID) 
{
    var containerDiv = document.getElementById(containerID);
    containerDiv.innerHTML = "An error has occurred. If this problem persists, please contact your site administrator.";
}